
<div class="gf-form-query">
	<div class="gf-form">
    <label class="gf-form-label gf-form-query-letter-cell">
      <a class="pointer" tabindex="1" ng-click="ctrl.toggleCollapse()">
        <span  ng-class="{muted: !ctrl.canCollapse}" class="gf-form-query-letter-cell-carret">
          <i class="fa fa-caret-down" ng-hide="ctrl.collapsed"></i>
          <i class="fa fa-caret-right" ng-show="ctrl.collapsed"></i>
        </span>
        <span class="gf-form-query-letter-cell-letter">{{ctrl.target.refId}}</span>
        <em class="gf-form-query-letter-cell-ds" ng-show="ctrl.target.datasource">({{ctrl.target.datasource}})</em>
      </a>
		</label>
  </div>

	<div class="gf-form-query-content gf-form-query-content--collapsed" ng-if="ctrl.collapsed">
		<div class="gf-form">
			<label class="gf-form-label pointer gf-form-label--grow" ng-click="ctrl.toggleCollapse()">
				{{ctrl.collapsedText}}
			</label>
		</div>
	</div>

	<div ng-transclude class="gf-form-query-content" ng-if="!ctrl.collapsed">
	</div>

	<div class="gf-form">
		<label class="gf-form-label dropdown">
			<a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
				<i class="fa fa-bars"></i>
			</a>
			<ul class="dropdown-menu pull-right" role="menu">
				<li role="menuitem" ng-if="ctrl.hasTextEditMode">
					<a tabindex="1" ng-click="ctrl.toggleEditorMode()">Toggle Edit Mode</a>
				</li>
				<li role="menuitem">
					<a tabindex="1" ng-click="ctrl.duplicateQuery()">Duplicate</a>
				</li>
				<li role="menuitem">
					<a tabindex="1" ng-click="ctrl.moveQuery(-1)">Move up</a>
				</li>
				<li role="menuitem">
					<a tabindex="1" ng-click="ctrl.moveQuery(1)">Move down</a>
				</li>
			</ul>
		</label>
    <label class="gf-form-label">
			<a ng-click="ctrl.toggleHideQuery()" role="menuitem">
				<i class="fa fa-eye"></i>
			</a>
		</label>
		<label class="gf-form-label">
			<a class="pointer" tabindex="1" ng-click="ctrl.removeQuery(ctrl.target)">
				<i class="fa fa-trash"></i>
			</a>
		</label>
	</div>
</div>

<div class="tight-form" ng-if="false">
	<ul class="tight-form-list pull-right">
		<li ng-show="ctrl.error" class="tight-form-item">
			<a bs-tooltip="ctrl.error" style="color: rgb(229, 189, 28)" role="menuitem">
				<i class="fa fa-warning"></i>
			</a>
		</li>
		<li class="tight-form-item small" ng-show="ctrl.target.datasource">
			<em>{{ctrl.target.datasource}}</em>
		</li>
		<li class="tight-form-item" ng-if="ctrl.toggleEditorMode">
			<a class="pointer" tabindex="1" ng-click="ctrl.toggleEditorMode()">
				<i class="fa fa-pencil"></i>
			</a>
		</li>
		<li class="tight-form-item">
			<div class="dropdown">
				<a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
					<i class="fa fa-bars"></i>
				</a>
				<ul class="dropdown-menu pull-right" role="menu">
					<li role="menuitem">
						<a tabindex="1" ng-click="ctrl.duplicateQuery()">Duplicate</a>
					</li>
					<li role="menuitem">
						<a tabindex="1" ng-click="ctrl.moveQuery(-1)">Move up</a>
					</li>
					<li role="menuitem">
						<a tabindex="1" ng-click="ctrl.moveQuery(1)">Move down</a>
					</li>
				</ul>
			</div>
		</li>
		<li class="tight-form-item last">
			<a class="pointer" tabindex="1" ng-click="ctrl.removeQuery(target)">
				<i class="fa fa-trash"></i>
			</a>
		</li>
	</ul>

	<ul class="tight-form-list">
		<li class="tight-form-item" style="min-width: 15px; text-align: center">
			{{ctrl.target.refId}}
		</li>
		<li>
			<a class="tight-form-item" ng-click="ctrl.toggleHideQuery()" role="menuitem">
				<i class="fa fa-eye"></i>
			</a>
		</li>
	</ul>

	<ul class="tight-form-list" ng-transclude>
	</ul>

	<div class="clearfix"></div>
</div>
